using Microsoft.Practices.SmartClient.DisconnectedAgent;
using Metro.Admin.BusinessEntities;
using System;
using System.Collections.Generic;

namespace Metro.SmartClient.Infrastructure.Interface.DSA.SharedServiceClient
{
	// Generated code for the web service.
	// Use this proxy to make requests to the service when working in an application that is occasionally connected
    public class Callback : CallbackBase
    {
        public static event EventHandler<EventArgs<User>> GetUsersAuthenticationReturn;
        public static event EventHandler<EventArgs<Exception>> GetUsersAuthenticationException;
        public static event EventHandler<EventArgs<Company>> GetCompanyParametersReturn;
        public static event EventHandler<EventArgs<Exception>> GetCompanyParametersException;
        public static event EventHandler<EventArgs<List<Order>>> GetOrdersFromUserReturn;
        public static event EventHandler<EventArgs<Exception>> GetOrdersFromUserException;
        public static event EventHandler<EventArgs<List<Transaction>>> GetTransactionsFromUserReturn;
        public static event EventHandler<EventArgs<Exception>> GetTransactionsFromUserException;

		#region UsersAuthentication
	
		public override void OnUsersAuthenticationReturn(Request request, object[] parameters, User returnValue)
		{
			 if (GetUsersAuthenticationReturn != null)
            {
                GetUsersAuthenticationReturn(this, new EventArgs<User>(returnValue));
            }
		}

		public override OnExceptionAction OnUsersAuthenticationException(Request request, Exception ex)
		{
			 if (GetUsersAuthenticationException != null)
            {
                GetUsersAuthenticationException(this, new EventArgs<Exception>(ex));
            }

            return OnExceptionAction.Retry;
		}
		
		#endregion UsersAuthentication
		
		#region GetCompanyParameters
	
		public override void OnGetCompanyParametersReturn(Request request, object[] parameters, Company returnValue)
		{
            if (GetCompanyParametersReturn != null)
            {
                GetCompanyParametersReturn(this, new EventArgs<Company>(returnValue));
            }
		}

		public override OnExceptionAction OnGetCompanyParametersException(Request request, Exception ex)
		{
            if (GetCompanyParametersException != null)
            {
                GetCompanyParametersException(this, new EventArgs<Exception>(ex));
            }

            return OnExceptionAction.Retry;
		}
		
		#endregion GetCompanyParameters
		
		#region GetOrdersFromUser
	
		public override void OnGetOrdersFromUserReturn(Request request, object[] parameters, List<Order> returnValue)
		{
            if (GetOrdersFromUserReturn != null)
            {
                GetOrdersFromUserReturn(this, new EventArgs<List<Order>>(returnValue));
            }
		}

		public override OnExceptionAction OnGetOrdersFromUserException(Request request, Exception ex)
		{
            if (GetOrdersFromUserException != null)
            {
                GetOrdersFromUserException(this, new EventArgs<Exception>(ex));
            }

            return OnExceptionAction.Retry;
		}
		
		#endregion GetOrdersFromUser
		
		#region GetTransactionsFromUser
	
		public override void OnGetTransactionsFromUserReturn(Request request, object[] parameters, List<Transaction>  returnValue)
		{
            if (GetTransactionsFromUserReturn != null)
            {
                GetTransactionsFromUserReturn(this, new EventArgs<List<Transaction>>(returnValue));
            }
		}

		public override OnExceptionAction OnGetTransactionsFromUserException(Request request, Exception ex)
		{
            if (GetTransactionsFromUserException != null)
            {
                GetTransactionsFromUserException(this, new EventArgs<Exception>(ex));
            }

            return OnExceptionAction.Retry;
		}
		
		#endregion GetTransactionsFromUser
		
	}
}
